﻿using System;
using System.Collections.Generic;
using Microsoft.WindowsAzure.StorageClient;

namespace Nardax.Azure.StorageClient
{
    public interface ICloudQueue
    {
        void AddMessage(CloudQueueMessage message);

        void AddMessage(CloudQueueMessage message, TimeSpan timeToLive);

        void Clear();

        void Create();

        bool CreateIfNotExist();

        void Delete();

        void DeleteMessage(string messageId, string popReceipt);

        void DeleteMessage(CloudQueueMessage message);

        bool Exists();

        CloudQueueMessage GetMessage();

        CloudQueueMessage GetMessage(TimeSpan visibilityTimeout);

        IEnumerable<CloudQueueMessage> GetMessages(int messageCount);

        IEnumerable<CloudQueueMessage> GetMessages(int messageCount, TimeSpan visibilityTimeout);

        CloudQueueMessage PeakMessage();

        IEnumerable<CloudQueueMessage> PeakMessages(int messageCount);

        int RetreiveApproximateMessageCount();

        int? ApproximateMessageCount { get; }

        string Name { get; }

        ICloudQueueClient ServiceClient { get; }
    }

    public interface ICloudQueue<T>
    {
        void AddMessage(T message);

        void AddMessage(T message, TimeSpan timeToLive);

        void Clear();

        void Create();

        bool CreateIfNotExist();

        void Delete();

        void DeleteMessage(string messageId, string popReceipt);

        void DeleteMessage(CloudQueueMessage message);

        bool Exists();

        ICloudQueueMessage<T> GetMessage();

        ICloudQueueMessage<T> GetMessage(TimeSpan visibilityTimeout);

        IEnumerable<ICloudQueueMessage<T>> GetMessages(int messageCount);

        IEnumerable<ICloudQueueMessage<T>> GetMessages(int messageCount, TimeSpan visibilityTimeout);

        ICloudQueueMessage<T> PeakMessage();

        IEnumerable<ICloudQueueMessage<T>> PeakMessages(int messageCount);

        int RetreiveApproximateMessageCount();

        int? ApproximateMessageCount { get; }

        string Name { get; }

        ICloudQueueClient ServiceClient { get; }
    }
}